
  
  (function() {
    const response = {
      data: {
        "type": "page",
        "title": "登录日志管理",
        "body": {
          "type": "crud",
          "api": {
            "url": "https://localhost:5001/api/LoginLogs",
            "method": "get",
            "sendOn": "this",
            "data": {
              "pageNumber": "${page}",
              "pageSize": "${perPage}",
              "userName": "${filters.userName}",
              "isSuccess": "${filters.isSuccess}"
            },
            "adaptor": function(payload, response, api) {
              return {
                "status": 0,
                "msg": "success",
                "data": {
                  "items": payload.items,
                  "total": payload.totalRecords
                }
              };
            }
          },
          "columnsTogglable": false,
          "headerToolbar": [
            "export-excel",
            "pagination",
            {
              "type": "button",
              "label": "刷新",
              "actionType": "reload"
            }
          ],
          "filter": {
            "title": "过滤",
            "body": {
              "type": "form",
              "mode": "inline",
              "api": false,
              "controls": [
                {
                  "type": "input-text",
                  "name": "userName",
                  "label": "用户名",
                  "placeholder": "请输入用户名"
                },
                {
                  "type": "select",
                  "name": "isSuccess",
                  "label": "登录结果",
                  "placeholder": "请选择",
                  "options": [
                    {
                      "label": "成功",
                      "value": true
                    },
                    {
                      "label": "失败",
                      "value": false
                    }
                  ],
                  "clearable": true
                },
                {
                  "type": "button",
                  "label": "搜索",
                  "level": "primary",
                  "actionType": "submit",
                  "block": false
                },
                {
                  "type": "button",
                  "label": "重置",
                  "level": "default",
                  "actionType": "clear"
                }
              ]
            }
          },
          "columns": [
            {
              "name": "id",
              "label": "ID",
              "type": "text",
              "hidden": true
            },
            {
              "name": "userName",
              "label": "用户名",
              "type": "text"
            },
            {
              "name": "loginTime",
              "label": "登录时间",
              "type": "datetime",
              "format": "YYYY-MM-DD HH:mm:ss",
              "sortable": true
            },
            {
              "name": "ipAddress",
              "label": "IP 地址",
              "type": "text"
            },
            {
              "name": "isSuccess",
              "label": "登录结果",
              "type": "tpl",
              "tpl": "${isSuccess ? '成功' : '失败'}",
              "align": "center",
              "className": "${isSuccess ? 'text-success' : 'text-danger'}"
            },
            {
              "name": "failureReason",
              "label": "失败原因",
              "type": "text",
              "tooltip": "hover to see",
              "maxLength": 50,
              "ellipsis": true
            },
            {
              "type": "operation",
              "label": "操作",
              "width": 80,
              "buttons": [
                {
                  "type": "button",
                  "label": "查看详情",
                  "level": "link",
                  "actionType": "dialog",
                  "dialog": {
                    "title": "登录日志详情",
                    "body": {
                      "type": "form",
                      "api": false,
                      "controls": [
                        {
                          "type": "static",
                          "name": "userName",
                          "label": "用户名",
                          "value": "${userName}"
                        },
                        {
                          "type": "static",
                          "name": "loginTime",
                          "label": "登录时间",
                          "value": "${loginTime|date:YYYY-MM-DD HH:mm:ss}"
                        },
                        {
                          "type": "static",
                          "name": "ipAddress",
                          "label": "IP 地址",
                          "value": "${ipAddress}"
                        },
                        {
                          "type": "static",
                          "name": "isSuccess",
                          "label": "登录结果",
                          "value": "${isSuccess ? '成功' : '失败'}"
                        },
                        {
                          "type": "static",
                          "name": "failureReason",
                          "label": "失败原因",
                          "value": "${failureReason}"
                        }
                      ]
                    }
                  }
                }
              ]
            }
          ],
          "pagination": {
            "type": "pagination",
            "perPage": 20,
            "align": "right"
          }
        }
      },
      status: 0
    }
  
    window.jsonpCallback && window.jsonpCallback(response);
  })();
  